(HSP3) sample6 [DeviceCapacity].hsp

sample\hspdsc\(HSP3) sample6 [DeviceCapacity].hsp » Plain Format

#include "hspdsc.as"
#include "gdi32.as"
	
	title "キャプチャデバイスの能力を表示"
	cls 4
	dsc_Init				// 初期化
	
	// デバイスリスト用の変数を初期化
	sdim devlist, dsc_GetDeviceListSize()
	// デバイスリストを変数に格納
	dsc_GetDeviceList devlist, 0
	if stat == 0 || stat == -2 : dialog "デバイスが見つかりません" : end

	objsize 300, 20
	combox did, 100, devlist

	objsize 150,20
	button "デバイスの能力を表示",*get

	button gosub "終了する",*exit
	onexit gosub *exit
	
	stop
	
*get
	// キャプチャ処理
	dsc_SetActiveSel 0

	dsc_Open did, 0, 0, 0, 0
	if stat < 0 : dialog "エラーが発生しました。("+stat+")",1,"DEVICE-ERROR" : stop
	gsel 0, 1

	// 0 やマイナスの値を返すことがあるので limit関数で制限しています。
	sdim fps, limit(dsc_GetDevCapConfigSize(0)*2, 64, 2147483647)
	sdim w, limit(dsc_GetDevCapConfigSize(1)*2, 64, 2147483647)
	sdim h, limit(dsc_GetDevCapConfigSize(2)*2, 64, 2147483647)

	list = ""
	dsc_GetDevCapConfig fps, w, h
	notesel fps
	repeat notemax
		notesel w
			noteget _w, cnt
		notesel h
			noteget _h, cnt
		notesel fps
			noteget _fps, cnt
		list += ""+_w+"x"+_h+" "+_fps+"fps\n"
	loop

	dialog list
	
	dsc_Stop
	dsc_Close
	
stop
	
*exit
end
return